.class Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;
.super Landroid/content/BroadcastReceiver;
.source "Platform.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/platform/Platform;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "BatteryBroadcastReceiver"
.end annotation


# instance fields
.field final synthetic this$0:Lcom/glympse/platform/Platform;


# direct methods
.method public constructor <init>(Lcom/glympse/platform/Platform;)V
    .locals 3
    .parameter

    .prologue
    .line 1119
    iput-object p1, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    .line 1115
    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    .line 1117
    sget-object v0, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    new-instance v1, Landroid/content/IntentFilter;

    const-string v2, "android.intent.action.BATTERY_CHANGED"

    invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p0, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 1118
    sget-object v0, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    new-instance v1, Landroid/content/IntentFilter;

    const-string v2, "android.intent.action.BATTERY_LOW"

    invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p0, v1}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    return-void
.end method

.method private Stop()V
    .locals 1

    .prologue
    .line 1124
    sget-object v0, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    invoke-virtual {v0, p0}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 1125
    return-void
.end method

.method static synthetic access$0(Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;)V
    .locals 0
    .parameter

    .prologue
    .line 1122
    invoke-direct {p0}, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->Stop()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 11
    .parameter "context"
    .parameter "intent"

    .prologue
    const/4 v10, 0x1

    const/4 v9, 0x0

    .line 1130
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v6

    .line 1132
    .local v6, strAction:Ljava/lang/String;
    const-string v7, "android.intent.action.BATTERY_CHANGED"

    invoke-virtual {v7, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_8

    .line 1146
    const-string v7, "plugged"

    invoke-virtual {p2, v7, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v4

    .line 1147
    .local v4, nPlugged:I
    const-string v7, "level"

    invoke-virtual {p2, v7, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v3

    .line 1148
    .local v3, nLevel:I
    const-string v7, "scale"

    const/16 v8, 0x64

    invoke-virtual {p2, v7, v8}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v5

    .line 1151
    .local v5, nScale:I
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    mul-int/lit8 v8, v3, 0x64

    div-int/2addr v8, v5

    iput v8, v7, Lcom/glympse/platform/Platform;->m_nBatteryPercent:I

    .line 1152
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    if-lez v4, :cond_5

    move v8, v10

    :goto_0
    iput-boolean v8, v7, Lcom/glympse/platform/Platform;->m_fExternalPower:Z

    .line 1154
    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "Battery CHANGED - level:"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, ", scale:"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, ", percent:"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    iget-object v8, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget v8, v8, Lcom/glympse/platform/Platform;->m_nBatteryPercent:I

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, ", plugged:"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 1157
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget v7, v7, Lcom/glympse/platform/Platform;->m_nBatteryPercent:I

    const/16 v8, 0x19

    if-gt v7, v8, :cond_6

    move v2, v10

    .line 1158
    .local v2, fLow:Z
    :goto_1
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget v7, v7, Lcom/glympse/platform/Platform;->m_nBatteryPercent:I

    const/16 v8, 0x1e

    if-lt v7, v8, :cond_7

    move v1, v10

    .line 1161
    .local v1, fGood:Z
    :goto_2
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget-boolean v0, v7, Lcom/glympse/platform/Platform;->m_fBatteryGood:Z

    .line 1164
    .local v0, fBatteryGood:Z
    if-eqz v2, :cond_0

    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget-boolean v7, v7, Lcom/glympse/platform/Platform;->m_fExternalPower:Z

    if-nez v7, :cond_0

    .line 1166
    const/4 v0, 0x0

    .line 1170
    :cond_0
    if-nez v1, :cond_1

    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget-boolean v7, v7, Lcom/glympse/platform/Platform;->m_fExternalPower:Z

    if-eqz v7, :cond_2

    .line 1172
    :cond_1
    const/4 v0, 0x1

    .line 1176
    :cond_2
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget-boolean v7, v7, Lcom/glympse/platform/Platform;->m_fBatteryGood:Z

    if-eq v0, v7, :cond_4

    .line 1179
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iput-boolean v0, v7, Lcom/glympse/platform/Platform;->m_fBatteryGood:Z

    .line 1184
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget-boolean v7, v7, Lcom/glympse/platform/Platform;->m_fBatteryGood:Z

    if-eqz v7, :cond_3

    .line 1186
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iput-boolean v9, v7, Lcom/glympse/platform/Platform;->m_fBatteryForce:Z

    .line 1189
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    iget-object v7, v7, Lcom/glympse/platform/Platform;->m_oServerPost:Lcom/glympse/platform/common/ServerPost;

    invoke-virtual {v7}, Lcom/glympse/platform/common/ServerPost;->PostNow()V

    .line 1193
    :cond_3
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    invoke-virtual {v7}, Lcom/glympse/platform/Platform;->StartStopLocation()V

    .line 1196
    iget-object v7, p0, Lcom/glympse/platform/Platform$BatteryBroadcastReceiver;->this$0:Lcom/glympse/platform/Platform;

    const/16 v8, 0x4000

    invoke-virtual {v7, v8}, Lcom/glympse/platform/Platform;->DoUpdate(I)V

    .line 1203
    .end local v0           #fBatteryGood:Z
    .end local v1           #fGood:Z
    .end local v2           #fLow:Z
    .end local v3           #nLevel:I
    .end local v4           #nPlugged:I
    .end local v5           #nScale:I
    :cond_4
    :goto_3
    return-void

    .restart local v3       #nLevel:I
    .restart local v4       #nPlugged:I
    .restart local v5       #nScale:I
    :cond_5
    move v8, v9

    .line 1152
    goto/16 :goto_0

    :cond_6
    move v2, v9

    .line 1157
    goto :goto_1

    .restart local v2       #fLow:Z
    :cond_7
    move v1, v9

    .line 1158
    goto :goto_2

    .line 1199
    .end local v2           #fLow:Z
    .end local v3           #nLevel:I
    .end local v4           #nPlugged:I
    .end local v5           #nScale:I
    :cond_8
    const-string v7, "android.intent.action.BATTERY_LOW"

    invoke-virtual {v7, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_4

    .line 1201
    const-string v7, "Battery LOW"

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    goto :goto_3
.end method
